package cn.scy.business.controller.xiamdx;

import cn.scy.annotation.PassToken;
import cn.scy.base.PageResult;
import cn.scy.base.ResponseDTO;
import cn.scy.business.domain.entity.xiamdx.XiamdxNumberInfo;
import cn.scy.business.domain.entity.xiamdx.XiamdxReportInfo;
import cn.scy.business.domain.param.xiamdx.XiamdxNotifyCustomerReq;
import cn.scy.business.domain.param.xiamdx.XiamdxNumberInfoBatchParam;
import cn.scy.business.domain.param.xiamdx.XiamdxNumberInfoParam;
import cn.scy.business.service.xiamdx.XiamdxNumberInfoService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * 厦门电信
 * 报备管理-号码表 前端控制器
 *
 * @author scy
 * @since 2025-04-27
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/xiamdx/number")
public class XiamdxNumberInfoController {

    private final XiamdxNumberInfoService xiamdxnumberInfoService;

    @GetMapping("listPage")
    public ResponseDTO<PageResult<XiamdxNumberInfo>> listPage(XiamdxNumberInfoParam param) {
        return ResponseDTO.ok(xiamdxnumberInfoService.listPage(param));
    }

    @GetMapping("info")
    public ResponseDTO<XiamdxNumberInfo> info(@RequestParam("id") String id) {
        return ResponseDTO.ok(xiamdxnumberInfoService.info(id));
    }

    @PostMapping("add")
    public ResponseDTO<Boolean> addNumber(@RequestBody XiamdxNumberInfo xiamdxNumberInfo) {
        return ResponseDTO.ok(xiamdxnumberInfoService.addNumber(xiamdxNumberInfo));
    }

    @PostMapping("addBatch")
    public ResponseDTO<Boolean> addNumberBatch(@RequestBody XiamdxNumberInfoBatchParam param) {
        return ResponseDTO.ok(xiamdxnumberInfoService.addNumberBatch(param));
    }

    @PostMapping("edit")
    public ResponseDTO<Boolean> editNumber(@RequestBody XiamdxNumberInfo numNumberInfo) {
        return ResponseDTO.ok(xiamdxnumberInfoService.editNumber(numNumberInfo));
    }

    @PostMapping("delete")
    public ResponseDTO<Boolean> deleteNumber(@RequestParam("id") String id) {
        return ResponseDTO.ok(xiamdxnumberInfoService.deleteNumber(id));
    }

    @PostMapping("report")
    public ResponseDTO<Boolean> report(@RequestBody XiamdxReportInfo numReportInfo) {
        return ResponseDTO.ok(xiamdxnumberInfoService.report(numReportInfo));
    }

    @PassToken
    @PostMapping("customerTelA/notify")
    public Map<String, Object> notifyReq(@RequestBody XiamdxNotifyCustomerReq req) {
        return xiamdxnumberInfoService.notifyReq(req);
    }

}
